Check valid parent selection hash string#12985
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a reported memory-safety issue in ATS parent selection parsing by adding validation for the optional &hash portion of parent entries, preventing oversized hash strings from being copied into fixed-size buffers.
Changes:
- Add a length check for the optional parent
&hashstring duringParentRecord::ProcessParents()parsing. - Fail parsing with a specific error when the hash string exceeds the allowed maximum.
bryancall
left a comment
There was a problem hiding this comment.
Thanks for the fix, Serris. The overall approach is correct — validating the hash string length before the memcpy is the right thing to do, and the regression tests are a good addition.
There's an off-by-one in the length check that needs fixing, and the test boundaries need to shift to match. Details in the inline comment.
Also, please resolve the Copilot comments that you've already addressed (the error message underscore fix and the regression test addition) so the review trail is clean.
Resolves #12973 by checking parent hash string length